package com.bwf.jdbc2;

import org.junit.Before;
import org.junit.Test;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/6/1 16:24
 * @Copyright 博为峰
 */
public class ClaTest {
    //    /public static void main(String[] args) throws Exception {
//        query();
//        insert();
//        selectById();
//    }
    private ClaDaoImpl claDao = null;

    @Before
    public void before() {
        claDao = new ClaDaoImpl();
    }

    @Test
    public void selectById() throws SQLException {
//        ClaDaoImpl claDao = new ClaDaoImpl();
        Cla cla = claDao.selectClaById(2);
        System.out.println("cla = " + cla);
    }

    @Test
    public void insert() throws SQLException {
//        ClaDaoImpl claDao = new ClaDaoImpl();
        Cla cla = new Cla(1, "66期", 66);
        claDao.insert(cla);
    }

    @Test
    public void query() throws Exception {
//        ClaDaoImpl claDao = new ClaDaoImpl();
        ArrayList<Cla> list = claDao.list();
        list.stream().forEach(System.out::println);
    }
}
